#ifndef __THERADPOOL_H__
#define __THREADPOOL_H__
#include <thread>
#include <vector>
#include "TaskQueue.h"
#include <functional>

using Task = function<void()>;

class ThreadPool{
public:
    ThreadPool(size_t threadNum,size_t queCapacity);
    ~ThreadPool();
    void start();
    void stop();
    void addTask(Task && taskcb);
    Task getTask();
    void doTask();
private:
    size_t _threadNum;
    vector<thread> _threads;
    size_t _queCapacity;
    TaskQueue _taskQue;
    bool _isExit;//判断线程池状态
};

#endif

